%!PS-Adobe-3.0
%%Title: Diplomacy Map
%%Creator: dpmap, using a map created with DPeye
%%DocumentPaperSizes: Letter
%%LanguageLevel: 2
%%Orientation: Landscape
%%Pages: (atend)
%%DocumentNeededResources: font Helvetica-Bold Courier Courier-Bold Times-Roman
%%EndComments

%%BeginDefaults
%%PageResources: font Helvetica-Bold Courier Courier-Bold Times-Roman
%%EndDefaults

% INFO
% MAP

%%BeginSetup
%<Play Setup /$RetreatColor ArrowRed /$BuildRays 16 /$ProposeColor ArrowWhite>
%<+ /$FogWaveLength 12 /$HalfSlashThickness 5 /$SpaceChar 32 /$PaintScaleFactor>
%<+ 1 /$MoveColor ArrowBlack /$MapUnitScale $MapDrawingScale>
%<+ /$FixedFontHeightRatio 1 /$BuildRadius 24 /$HeadLength 20 /$MoveRadius 8>
%<+ /$FrameMargin {$FrameThickness $FrameMarginRatio mul} /$MapUnitLetterSize>
%<+ 14 /$TextFontWidthRatio $FixedFontWidthRatio /$ArrowShaftLength 40>
%<+ /$MapImageLeft 0 /$PageHeight 612 /$MapImageRight 104 /$SwitchToMapMode>
%<+ SwitchToMapMode /$FindFont findfont /$Pi 3.14159 /$InitModes {>
%<+ /FinishReport { } def /InTextMode true def } /$MapUnitOffsetX 0>
%<+ /$TextFontHeight {$TextFontHeightRatio $TextFontSize mul} /$MapUnitOffsetY>
%<+ 8 /$MapNameOffsetX 0 /$FixedFontWidthRatio .6 /$ArrowLineThickness 1>
%<+ /$MapNameOffsetY -14 /$BuildRayFraction {1 3 div} /$TextFontHeightRatio>
%<+ $FixedFontHeightRatio /$PageWidth 792 /$ArrowBase 0 /$AbsoluteRoundingError>
%<+ 0 /$HalfSlashLength 16 /$HalfHeadThickness 5 /$MapImageWidth {>
%<+ $MapImageRight $MapImageLeft sub } /$MapNameFontSize 14 /$MapImageTop 46>
%<+ /$FogWaveRaiseHeight 3 /$FogWaveRaiseLength 4 /$ConvoyRadius 12>
%<+ /$DiscoverColor ArrowBlue /$HalfThickness 1 /$FogWaveDistance 8>
%<+ /$ArrowRotate {} /$FogWaveThickness 4 /$MapSupplyScale $MapDrawingScale>
%<+ /$TextFontWidth {$TextFontWidthRatio $TextFontSize mul} /$MapImageBottom 0>
%<+ /$HoldRadius 24 /$MapNameScale $MapUnitScale /$BuildColor ArrowWhite>
%<+ /$FrameThickness 4 /$BuildRayThickness 6 /$FrameMarginRatio .5>
%<+ /$FinishModes {InTextMode { FinishReport } { r } ifelse} /$MapImageHeight {>
%<+ $MapImageTop $MapImageBottom sub } /$MapDrawingScale .3>

%<Play Definitions>

%<Act Shorthand>
/bd { bind def } bind def
/xd { exch def } bd
/ld { load def } bd
%</Act>

%<Sketch Math>
%$ /ifloor { $AbsoluteRoundingError add floor cvi } bd
/ifloor { .001 add floor cvi } bd
%$ /iceiling { $AbsoluteRoundingError sub ceiling cvi } bd
/iceiling { .001 sub ceiling cvi } bd
/min { 2 copy gt { exch } if pop } bd
/max { 2 copy lt { exch } if pop } bd
/secure_atan { 2 copy 0 eq exch 0 eq and { pop pop 0 } { atan } ifelse } bd
/center { 3 2 roll add 2 div 3 1 roll add 2 div exch } bd
%</Sketch>

%<Scene PaintOperators /operator ld /format {name name}>
/a /arc ld
/c /curveto ld
/d /setdash ld
/f /fill ld
/h /show ld
/k /stroke ld
/l /lineto ld
/m /moveto ld
/n /newpath ld
/o /rotate ld
/p /closepath ld
/r /grestore ld
/s /gsave ld
/t /translate ld
/w /setlinewidth ld
/x /scale ld
/y /scalefont ld
/z /setfont ld
%</Scene>

%<Act Powers>
/Powers 20 dict def
%</Act>

%<Sketch MapUnitDefinitions>
%%IncludeResource: font Helvetica-Bold
%$ /MapUnitLetterFont /Helvetica-Bold $FindFont $MapUnitLetterSize y def
/MapUnitLetterFont /Helvetica-Bold findfont 14 y def
%</Sketch>

%<Sketch MapNameDefinitions>
%%IncludeResource: font Helvetica-Bold
%$ /MapNameFont /Helvetica-Bold $FindFont $MapNameFontSize y def
/MapNameFont /Helvetica-Bold findfont 14 y def
%</Sketch>

%<Sketch TextColumnDefinitions>
%%IncludeResource: font Courier
%$ /TextFixedFont /Courier $FindFont def
/TextFixedFont /Courier findfont def
%</Sketch>

%<Sketch TextHeadingDefinitions>
%%IncludeResource: font Courier-Bold
%$ /TextHeadingFont /Courier-Bold $FindFont def
/TextHeadingFont /Courier-Bold findfont def
%</Sketch>

%<Sketch TextTitleDefinitions>
%%IncludeResource: font Times-Roman
%$ /TextTitleFont /Times-Roman $FindFont def
/TextTitleFont /Times-Roman findfont def
%</Sketch>

%</Play>

%<Play Chapters /references {() PageLayout MapImageScale} /define bd>

%<Chapter PageSetup>
/PageSetup {

%<Sketch TurnLandscape>
	%$ $PageHeight 0 t
	612 0 t
	90 o
%</Sketch>

%<Sketch SetupGState>
	%$ $InitModes
	/FinishReport { } def /InTextMode true def
	Black
	MovePhase
%</Sketch>

} bd
%</Chapter>

%<Chapter ShowPage>
/ShowPage {
	DrawAliases
	%$ $FinishModes
	InTextMode { FinishReport } { r } ifelse
	FrameMap

%<Part none/>

	showpage
} bd
%</Chapter>

%<Chapter VisitColors /define def>
/VisitColors {
	3 dict begin
	/c xd /r xd /g xd

%<Scene GrayColors /operator g /format {name 1}>
	/BorderBlack .1 g
	/MountainGrey .5 g
	/IceGrey .9 g
	/ArrowBlack 0 g
	/ArrowWhite .9 g
	/Black 0 g
	/White .9 g
%</Scene>

%<Scene RGBColors /operator r /format {name 3}>
	/LandBrown .8 .7 .4 r
	/SeaBlue .1 .4 .6 r
	/ArrowRed 1 0 0 r
	/ArrowBlue .529 .808 .922 r
	/Brown .6 .45 .2 r
%</Scene>

%<Scene CMYKColors /operator g /format {name 1}/>

	end
} def
%</Chapter>

%<Chapter VisitPowers /define def>
/VisitPowers {
	1 dict begin
	/p xd

%<Scene Powers /operator p /format {uname ustring name name}>
	/UNOWNED (?) /Brown /White p
%</Scene>

	end
} def
%</Chapter>

%<Chapter Controls>
/Controls {

%<Act Controls>
	/ChangeController true def
%</Act>

} bd
%</Chapter>

%<Chapter DrawFleet /$StrokeUnit { Controlled { s 6 $PaintScaleFactor div w>
%<+ Outer k r } if 2 $PaintScaleFactor div w Contrast k } /$FillUnit {Paint f}>
/DrawFleet {
	%$ $SwitchToMapMode
	SwitchToMapMode
	Power begin
	s t

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintFleet>
	-26 -7 m -26 -2 l -19 -2 l -19 -1 l % to bow
	-22 -1 l -22 0 l -15 0 l -15 1 l % A turret
	-18 1 l -18 2 l -10 2 l -10 0 l % B turret
	-9 0 l -9 4 l -8 4 l -8 6 l % conn tower
	-6 6 l -6 5 l -5 5 l -5 9 l % Infra struct
	-3 9 l -3 14 l -2 14 l -2 9 l % funnel 1
	0 9 l 0 5 l 1 5 l 1 8 l % funnel 2
	3 8 l 3 13 l 4 13 l 4 8 l % mast 2
	6 8 l 6 0 l 8 0 l 8 2 l % funnel 2
	16 2 l 16 1 l 13 1 l 13 0 l % C turret
	20 0 l 20 -1 l 17 -1 l 17 -2 l % D turret
	23 -2 l 23 -3 l 25 -3 l 25 -5 l % stern
	24 -5 l 24 -7 l p
	%$ s $StrokeUnit r $FillUnit
	s Controlled { s 6 w Outer k r } if 2 w Contrast k r Paint f
%</Sketch>

%<Act PaintLetter>
	Offset aload pop m
	MapUnitLetterFont z
	Contrast Letter h
%</Act>

	r
	end
} bd
%</Chapter>

%<Chapter DrawArmy /$StrokeUnit { Controlled { s 6 $PaintScaleFactor div w>
%<+ Outer k r } if 2 $PaintScaleFactor div w Contrast k } /$FillUnit {Paint f}>
/DrawArmy {
	%$ $SwitchToMapMode
	SwitchToMapMode
	Power begin
	s t

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintArmy>
	n 0 0 9 0 360 a p % wheel
	%$ $StrokeUnit
	Controlled { s 6 w Outer k r } if 2 w Contrast k
	-20 7 m 10 7 l 10 3 l 14 3 l
	14 1 l -16 1 l -16 3 l -20 3 l p % barrel
	4 2 m 24 -8 l 26 -8 l 18 -8 l -2 2 l % carriage
	%$ s $StrokeUnit r $FillUnit
	s Controlled { s 6 w Outer k r } if 2 w Contrast k r Paint f
	n 0 0 9 0 360 a p % wheel
	%$ $FillUnit
	Paint f
%</Sketch>

%<Act PaintLetter>
	Offset aload pop m
	MapUnitLetterFont z
	Contrast Letter h
%</Act>

	r
	end
} bd
%</Chapter>

%<Chapter DrawAlias>
/DrawAlias {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	3 1 roll t

%<Sketch LocateName>
	%$ $MapNameScale dup x
	.3 .3 x
	%$ $MapNameOffsetX $MapNameOffsetY t
	0 -14 t
%</Sketch>

%<Act PaintName>
	MapNameFont z
	dup stringwidth pop -2 div 0 neg m h
%</Act>

	r
} bd
%</Chapter>

%<Chapter DrawName>
/DrawName {
	pop pop pop

%<Part none/>

} bd
%</Chapter>

%<Chapter VisitTerritories /format {ustring value value} /$NumberOfScenes 0>
%<+ /define def>
/VisitTerritories {
	%$ $NumberOfScenes dict begin
	0 dict begin

%<Act Operators/>

	end
} def
%</Chapter>

%<Chapter VisitSupplies /format {uname value value} /$NumberOfScenes 0 /define>
%<+ def>
/VisitSupplies {
	%$ $NumberOfScenes dict begin
	0 dict begin

%<Act Operators/>

	end
} def
%</Chapter>

%<Chapter supply>
/supply {
	%$ $SwitchToMapMode
	SwitchToMapMode
	Power begin
	s
	t

%<Sketch LocateSupply>
	%$ $MapSupplyScale dup x
	.3 .3 x
%</Sketch>

%<Act PaintControllableSupply>
	Controlled {
		Outer
		n 0 0 8 0 360 a f
		Contrast
		n 0 0 6 0 360 a f
	} if
	Paint
	n 0 0 4 0 360 a f
%</Act>

	r
	end
} bd
%</Chapter>

%<Chapter SetArrowStateOk>
/SetArrowStateOk {

%<Act OkOrder>
	[] 0 d
%</Act>

} bd
%</Chapter>

%<Chapter OkOrder>
/OkOrder {
	/SetArrowState /SetArrowStateOk ld

%<Part none/>

} bd
%</Chapter>

%<Chapter SetArrowStateFailed>
/SetArrowStateFailed {

%<Act FailedOrder>
	[4 6] 2 d
%</Act>

} bd
%</Chapter>

%<Chapter FailedOrder>
/FailedOrder {
	/SetArrowState /SetArrowStateFailed ld

%<Part none/>

} bd
%</Chapter>

%<Chapter MovePhase /$ArrowBase $HeadLength>
/MovePhase {
	%$ /ArrowColor /$MoveColor ld
	/ArrowColor /ArrowBlack ld
	%$ /ArrowBase $ArrowBase def
	/ArrowBase 20 def
	/TraceArrowHead /TraceSingleArrowHead ld
	InTextMode not { ArrowColor } if

%<Part none/>

} bd
%</Chapter>

%<Chapter RetreatPhase /$ArrowBase { $HeadLength 2 mul $HalfThickness>
%<+ $HalfHeadThickness div sub }>
/RetreatPhase {
	%$ /ArrowColor /$RetreatColor ld
	/ArrowColor /ArrowRed ld
	%$ /ArrowBase $ArrowBase def
	/ArrowBase 39.8 def
	/TraceArrowHead /TraceDoubleArrowHead ld
	InTextMode not { ArrowColor } if

%<Part none/>

} bd
%</Chapter>

%<Chapter ProposePhase /$ArrowBase { $HeadLength 2 mul $HalfThickness>
%<+ $HalfHeadThickness div sub }>
/ProposePhase {
	%$ /ArrowColor /$ProposeColor ld
	/ArrowColor /ArrowWhite ld
	%$ /ArrowBase $ArrowBase def
	/ArrowBase 39.8 def
	/TraceArrowHead /TraceDoubleArrowHead ld
	InTextMode not { ArrowColor } if

%<Part none/>

} bd
%</Chapter>

%<Chapter TraceSingleArrowHead>
/TraceSingleArrowHead {

%<Sketch TraceSingleArrowHead>
	% draw the arrow head ...
	n
	%$ dup $HalfHeadThickness neg m
	dup -5 m
	%$ dup $HeadLength add 0 l
	dup 20 add 0 l
	%$ dup $HalfHeadThickness l
	dup 5 l
	p
%</Sketch>

} bd
%</Chapter>

%<Chapter TraceDoubleArrowHead>
/TraceDoubleArrowHead {

%<Sketch TraceDoubleArrowHead>
	% draw the double arrow head ...
	n
	%$ dup $HalfHeadThickness neg m
	dup -5 m
	%$ dup $HeadLength $HalfThickness $HalfHeadThickness div sub add
	dup 19.8 add
	%$ dup $HalfThickness neg l
	dup -1 l
	%$ dup $HalfHeadThickness neg l
	dup -5 l
	%$ dup $HeadLength add 0 l
	dup 20 add 0 l
	%$ dup $HalfHeadThickness l
	dup 5 l
	%$ $HalfThickness l
	1 l
	%$ dup $HalfHeadThickness l
	dup 5 l
	p
%</Sketch>

} bd
%</Chapter>

%<Chapter PaintArrowMove /$ArrowBase ArrowBase>
/PaintArrowMove {
	s

%<Sketch LocateArrow>
	3 index 3 index t
	3 2 roll sub 3 1 roll exch sub exch
	2 copy dup mul exch dup mul add sqrt 3 1 roll exch secure_atan
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
	o
	%$ $MapUnitScale div $ArrowBase sub
	.3 div ArrowBase sub
%</Sketch>

%<Sketch ShortenArrowTail>
	% if base of arrow is long enough, shorten it enough
	% to e.g. move arrow start beyond support circle
	%$ dup $MapUnitLetterSize gt {
	dup 14 gt {
		%$ $MapUnitLetterSize dup 0 t sub
		14 14 0 t sub
	} {
		0 t 0
	} ifelse
%</Sketch>

%<Sketch ShortenArrowTip>
	% if base is still too long, shorten it some more
	% to make arrow head touch support circle
	%$ dup $MapUnitLetterSize gt {
	dup 14 gt {
		%$ $MapUnitLetterSize sub
		14 sub
	} {
		pop 0
	} ifelse
%</Sketch>

%<Play PaintArrowMove>
	%$   $ArrowLineThickness w
	1 w

%<Part none/>

%<Act TraceArrowHead>
	TraceArrowHead
%</Act>

	k
	% now the shaft ...
	%$   $HalfThickness 2 mul w
	2 w
	0 0 m
	0 l
	k
%</Play>

	r
} bd
%</Chapter>

%<Chapter PaintArrowCircle>
/PaintArrowCircle {
	s
	5 1 roll

%<Sketch LocateArrow>
	3 index 3 index t
	3 2 roll sub 3 1 roll exch sub exch
	2 copy dup mul exch dup mul add sqrt 3 1 roll exch secure_atan
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
	o
	%$ $MapUnitScale div $ArrowBase sub
	.3 div
%</Sketch>

%<Sketch ArrowCircleBase>
	1 index sub
%</Sketch>

%<Sketch ShortenArrowTail>
	% if base of arrow is long enough, shorten it enough
	% to e.g. move arrow start beyond support circle
	%$ dup $MapUnitLetterSize gt {
	dup 14 gt {
		%$ $MapUnitLetterSize dup 0 t sub
		14 14 0 t sub
	} {
		0 t 0
	} ifelse
%</Sketch>

%<Sketch PaintArrowCircle>
	% draw the circle ...
	%$ $ArrowLineThickness w
	1 w
	n
	2 copy add 0 4 3 roll 0 360 a
	p k
	% now the shaft ...
	%$ $HalfThickness 2 mul w
	2 w
	0 0 m
	0 l
	k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter PaintArrowArrive /$ArrowRotate {180 rotate} /$ArrowBase ArrowBase>
/PaintArrowArrive {
	s

%<Sketch LocateTrailingArrow>
	t
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
	%$ $ArrowRotate $MapUnitLetterSize $ArrowShaftLength add $ArrowBase add neg 0 t
	180 rotate 54 ArrowBase add neg 0 t
	%$ $ArrowShaftLength
	40
%</Sketch>

%<Play PaintArrowMove>
	%$   $ArrowLineThickness w
	1 w

%<Part none/>

%<Act TraceArrowHead>
	TraceArrowHead
%</Act>

	k
	% now the shaft ...
	%$   $HalfThickness 2 mul w
	2 w
	0 0 m
	0 l
	k
%</Play>

	-5 0 m -10 0 l
	-15 0 m -20 0 l
	k
	r
} bd
%</Chapter>

%<Chapter PaintArrowDepart>
/PaintArrowDepart {
	s

%<Sketch LocateTrailingArrow>
	t
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
	%$ $ArrowRotate $MapUnitLetterSize $ArrowShaftLength add $ArrowBase add neg 0 t
	-54 0 t
	%$ $ArrowShaftLength
	40
%</Sketch>

%<Sketch TraceLineShaft>
	%$ $HalfThickness 2 mul w
	2 w
	0 0 m
	0 l
%</Sketch>

	-6 0 m -10 0 l
	-16 0 m -20 0 l
	k
	r
} bd
%</Chapter>

%<Chapter ArrowMove>
/ArrowMove {
	%$ $SwitchToMapMode
	SwitchToMapMode
	SetArrowState
	s

%<Part none/>

	PaintArrowMove
	r
} bd
%</Chapter>

%<Chapter ArrowHold>
/ArrowHold {
	%$ $SwitchToMapMode
	SwitchToMapMode
	SetArrowState
	s

%<Part none/>

	%$ $HoldRadius PaintArrowCircle
	24 PaintArrowCircle
	r
} bd
%</Chapter>

%<Chapter ArrowSupport>
/ArrowSupport {
	%$ $SwitchToMapMode
	SwitchToMapMode
	SetArrowState
	s

%<Part none/>

	center
	%$ $MoveRadius PaintArrowCircle
	8 PaintArrowCircle
	r
} bd
%</Chapter>

%<Chapter ArrowConvoy>
/ArrowConvoy {
	%$ $SwitchToMapMode
	SwitchToMapMode
	SetArrowState
	s

%<Part none/>

	center
	%$ $ConvoyRadius PaintArrowCircle
	12 PaintArrowCircle
	r
} bd
%</Chapter>

%<Chapter ArrowArrive>
/ArrowArrive {
	%$ $SwitchToMapMode
	SwitchToMapMode
	SetArrowState
	s

%<Part none/>

	PaintArrowArrive
	r
} bd
%</Chapter>

%<Chapter ArrowDepart>
/ArrowDepart {
	%$ $SwitchToMapMode
	SwitchToMapMode
	SetArrowState
	s

%<Part none/>

	PaintArrowDepart
	r
} bd
%</Chapter>

%<Chapter ArrowRetreat>
/ArrowRetreat {
	RetreatPhase
	ArrowMove
	MovePhase

%<Part none/>

} bd
%</Chapter>

%<Chapter ArrowPropose>
/ArrowPropose {
	ProposePhase
	ArrowMove
	MovePhase

%<Part none/>

} bd
%</Chapter>

%<Chapter ArrowRetreatArrive>
/ArrowRetreatArrive {
	RetreatPhase
	ArrowArrive
	MovePhase

%<Part none/>

} bd
%</Chapter>

%<Chapter ArrowRetreatDepart>
/ArrowRetreatDepart {
	RetreatPhase
	ArrowDepart
	MovePhase

%<Part none/>

} bd
%</Chapter>

%<Chapter BuildUnit>
/BuildUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	t
	%$ $BuildColor
	ArrowWhite

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintBuildCircle /$BuildDashStart {$BuildRayLength 2 div}>
%<+ /$BuildSpaceLength {$BuildDashLength 1 $BuildRayFraction sub mul}>
%<+ /$BuildRayLength {$BuildDashLength $BuildRayFraction mul} /$BuildDashLength>
%<+ { $Pi 2 mul $BuildRadius mul $BuildRays div }>
	%$ $BuildRayThickness w [ $BuildRayLength# $BuildSpaceLength# ] $BuildDashStart# d
	6 w [ 3.14 6.28 ] 1.57 d
	n
	%$ 0 0 $BuildRadius 0 360 a
	0 0 24 0 360 a
	p k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter SlashUnit>
/SlashUnit {
	s
	3 1 roll t

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch TraceSlash>
	n
	%$ $HalfSlashThickness neg $HalfSlashLength sub $HalfSlashLength neg m
	-21 -16 m
	%$ $HalfSlashThickness neg $HalfSlashLength add $HalfSlashLength l
	11 16 l
	%$ $HalfSlashThickness $HalfSlashLength add $HalfSlashLength l
	21 16 l
	%$ $HalfSlashThickness $HalfSlashLength sub $HalfSlashLength neg l
	-11 -16 l
	p
%</Sketch>

	exec
	r
} bd
%</Chapter>

%<Chapter DestroyUnit>
/DestroyUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	%$ { $RetreatColor f } SlashUnit
	{ ArrowRed f } SlashUnit

%<Part none/>

} bd
%</Chapter>

%<Chapter DisbandUnit>
/DisbandUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	%$ { s $BuildColor f r $ArrowLineThickness w $RetreatColor k } SlashUnit
	{ s ArrowWhite f r 1 w ArrowRed k } SlashUnit

%<Part none/>

} bd
%</Chapter>

%<Chapter RemoveUnit>
/RemoveUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	%$ { $BuildColor f } SlashUnit
	{ ArrowWhite f } SlashUnit

%<Part none/>

} bd
%</Chapter>

%<Chapter FindUnit>
/FindUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	t
	%$ $DiscoverColor
	ArrowBlue

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintBuildCircle /$BuildDashStart {$BuildRayLength 2 div}>
%<+ /$BuildSpaceLength {$BuildDashLength 1 $BuildRayFraction sub mul}>
%<+ /$BuildRayLength {$BuildDashLength $BuildRayFraction mul} /$BuildDashLength>
%<+ { $Pi 2 mul $BuildRadius mul $BuildRays div }>
	%$ $BuildRayThickness w [ $BuildRayLength# $BuildSpaceLength# ] $BuildDashStart# d
	6 w [ 3.14 6.28 ] 1.57 d
	n
	%$ 0 0 $BuildRadius 0 360 a
	0 0 24 0 360 a
	p k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter LoseUnit>
/LoseUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	t
	%$ $DiscoverColor
	ArrowBlue

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintFogWave>
	%$ $FogWaveThickness w
	4 w
	%$ $FogWaveLength neg $FogWaveDistance 2 div m
	-12 4 m
	%$ $FogWaveLength neg $FogWaveRaiseLength add $FogWaveDistance 2 div $FogWaveRaiseHeight add $FogWaveRaiseLength neg $FogWaveDistance 2 div $FogWaveRaiseHeight add 0 $FogWaveDistance 2 div c
	-8 7 -4 7 0 4 c
	%$ $FogWaveRaiseLength $FogWaveDistance 2 div $FogWaveRaiseHeight sub $FogWaveLength $FogWaveRaiseLength sub $FogWaveDistance 2 div $FogWaveRaiseHeight sub $FogWaveLength $FogWaveDistance 2 div c
	4 1 8 1 12 4 c
	%$ $FogWaveLength neg $FogWaveDistance 2 div neg m
	-12 -4 m
	%$ $FogWaveLength neg $FogWaveRaiseLength add $FogWaveDistance 2 div neg $FogWaveRaiseHeight add $FogWaveRaiseLength neg $FogWaveDistance 2 div neg $FogWaveRaiseHeight add 0 $FogWaveDistance 2 div neg c
	-8 -1 -4 -1 0 -4 c
	%$ $FogWaveRaiseLength $FogWaveDistance 2 div neg $FogWaveRaiseHeight sub $FogWaveLength $FogWaveRaiseLength sub $FogWaveDistance 2 div neg $FogWaveRaiseHeight sub $FogWaveLength $FogWaveDistance 2 div neg c
	4 -7 8 -7 12 -4 c
	k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter QueryUnit>
/QueryUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	t
	%$ $ProposeColor
	ArrowWhite

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintFogWave>
	%$ $FogWaveThickness w
	4 w
	%$ $FogWaveLength neg $FogWaveDistance 2 div m
	-12 4 m
	%$ $FogWaveLength neg $FogWaveRaiseLength add $FogWaveDistance 2 div $FogWaveRaiseHeight add $FogWaveRaiseLength neg $FogWaveDistance 2 div $FogWaveRaiseHeight add 0 $FogWaveDistance 2 div c
	-8 7 -4 7 0 4 c
	%$ $FogWaveRaiseLength $FogWaveDistance 2 div $FogWaveRaiseHeight sub $FogWaveLength $FogWaveRaiseLength sub $FogWaveDistance 2 div $FogWaveRaiseHeight sub $FogWaveLength $FogWaveDistance 2 div c
	4 1 8 1 12 4 c
	%$ $FogWaveLength neg $FogWaveDistance 2 div neg m
	-12 -4 m
	%$ $FogWaveLength neg $FogWaveRaiseLength add $FogWaveDistance 2 div neg $FogWaveRaiseHeight add $FogWaveRaiseLength neg $FogWaveDistance 2 div neg $FogWaveRaiseHeight add 0 $FogWaveDistance 2 div neg c
	-8 -1 -4 -1 0 -4 c
	%$ $FogWaveRaiseLength $FogWaveDistance 2 div neg $FogWaveRaiseHeight sub $FogWaveLength $FogWaveRaiseLength sub $FogWaveDistance 2 div neg $FogWaveRaiseHeight sub $FogWaveLength $FogWaveDistance 2 div neg c
	4 -7 8 -7 12 -4 c
	k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter SplitString>
/SplitString {

%<Sketch SplitString>
	7 dict begin
	/nrChars xd
	/indentString xd
	/objectString xd
	/objectLast objectString length 1 sub def
	% Short string?
	objectLast nrChars lt {
		false objectString
	} {
		% Look for a suitable place to split.
		% First tracking backwards, if that doesn't work, look forward.
		/splitIndex -1 def
		nrChars -1 0 {
			%$ objectString 1 index get $SpaceChar eq {
			objectString 1 index get 32 eq {
				/splitIndex xd exit
			} if pop
		} for splitIndex -1 eq {
			nrChars 1 add 1 objectLast {
				%$ objectString 1 index get $SpaceChar eq {
				objectString 1 index get 32 eq {
					/splitIndex xd exit
				} if pop
			} for
		} if
		splitIndex -1 eq splitIndex objectLast eq or {
			false objectString
		} {
			% The first part.
			objectString 0 splitIndex getinterval
			% The second part.
			objectString splitIndex 1 add objectLast splitIndex sub getinterval
			% Add indentation if needed.
			indentString length 0 gt {
				dup length indentString length add string
				dup 0 indentString putinterval
				dup indentString length 4 3 roll putinterval
			} if
			% Add white space of the first part.
			/nonSpaceIndex objectLast 1 add def
			0 1 objectLast {
				%$ objectString 1 index get $SpaceChar ne {
				objectString 1 index get 32 ne {
					/nonSpaceIndex xd exit
				} if pop
			} for
			nonSpaceIndex 0 gt nonSpaceIndex splitIndex lt and {
				dup length nonSpaceIndex add string
				dup 0 objectString 0 nonSpaceIndex getinterval putinterval
				dup nonSpaceIndex 4 3 roll putinterval
			} if
			exch true exch
		} ifelse
	} ifelse
	end
%</Sketch>

} bd
%</Chapter>

%<FrameLayout PageLayout /$SetTextFont {TextFixedFont $TextFontSize# y z}>
%<+ /$MapFrameBottom 141.28461538 /references { Map { ImageGrid ImageFrame>
%<+ Image } { Left Bottom Width Height ImageScale FrameLeft FrameBottom>
%<+ FrameWidth FrameHeight } } /$MapFrameHeight 329.43076923 /layout ImageGrid>
%<+ /$MapImageScale 7.16153846 /marginWidth 20 /$MapBottom 141.28461538>
%<+ /$MapHeight 329.43076923 /height $PageHeight /$MapWidth 744.8>
%<+ /$TextFontSize 8 /$MapLeft 23.6 /$MapFrameLeft 25.6 /marginHeight 20 /type>
%<+ proc /width $PageWidth /fitWidth 1 /define bd /fitHeight 1>
%<+ /$ClipAndTransformToMap { $MapFrameLeft# $MapFrameBottom# $MapFrameWidth#>
%<+ $MapFrameHeight# rectclip $MapImageScale#4 dup x>
%<+ {$MapLeft $MapImageScale div $MapImageLeft sub}#>
%<+ {$MapBottom $MapImageScale div $MapImageBottom sub}# t } /$MapFrameWidth>
%<+ 740.8 /$MapDrawingScale 1>

%<Chapter DrawLayoutBorders>
/DrawLayoutBorders {
	s
	%$ $SetTextFont
	TextFixedFont 8 y z

%<Part none/>

	r
} bd
%</Chapter>

%<GridLayout ImageGrid /cellWidth $TextFontWidth /cellHeight $TextFontHeight>
%<+ /fitWidth 2 /fitHeight 2 /layout ImageFrame>

%<FrameLayout ImageFrame /marginWidth $FrameMargin /fitWidth 2 /fitHeight 2>
%<+ /layout Image /marginHeight $FrameMargin>

%<ImageLayout Image /widthPriority 5 /imageWidth $MapImageWidth /imageHeight>
%<+ $MapImageHeight /heightPriority 5>
%</ImageLayout>

%</FrameLayout>

%</GridLayout>

%<Chapter OwnerReport>
/OwnerReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteOwner>
/WriteOwner {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter AdjustReport>
/AdjustReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteAdjust>
/WriteAdjust {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter RetreatReport>
/RetreatReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteRetreat>
/WriteRetreat {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter OrderReport>
/OrderReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteOrder>
/WriteOrder {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter DrawTitle>
/DrawTitle {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter SwitchToTextMode>
/SwitchToTextMode {
	InTextMode {
		FinishReport /FinishReport { } def
	} {
		r /InTextMode true def
	} ifelse

%<Part none/>

} bd
%</Chapter>

%<Chapter SwitchToMapMode>
/SwitchToMapMode {
	InTextMode {
		FinishReport /FinishReport { } def
		/InTextMode false def
		s
		%$ $ClipAndTransformToMap
		25.6 141.28 740.8 329.43 rectclip 7.1615 7.1615 x 3.3 19.73 t
		ArrowColor
		OkOrder
	} if

%<Part none/>

} bd
%</Chapter>

%<Chapter FrameMap /$Bottom $MapBottom /$Right {$MapLeft $MapWidth add} /$Top {>
%<+ $MapBottom $MapHeight add } /$Left $MapLeft>
/FrameMap {
	s
	%$ {4 $MapDrawingScale mul 2 mul}# w Brown
	8 w Brown
	{
		%$ $Left# $Bottom# m $Right# $Bottom# l $Right# $Top# l $Left# $Top# l p
		23.6 141.28 m 768.4 141.28 l 768.4 470.72 l 23.6 470.72 l p
	} dup exec
	clipsave s strokepath pathbbox r 2 copy m exch 3 index l 2 index 3 2 roll l l p eoclip n exec p k cliprestore

%<Part none/>

	r
} bd
%</Chapter>

%</FrameLayout>

%<Chapter PaintMap>
/PaintMap {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s

%<Sketch PaintBackGround>
	%$ SeaBlue $MapImageLeft# $MapImageBottom# $MapImageWidth# $MapImageHeight# rectfill
	SeaBlue 0 0 104 46 rectfill
%</Sketch>

%<Act PaintOutlines>
	IncludeArmy
%</Act>

	r
} bd
%</Chapter>

%<Chapter DrawMap>
/DrawMap {
	PageSetup
	PaintMap

%<Part none/>

} bd
%</Chapter>

%<Chapter DrawAliases>
/DrawAliases {

%<Part none/>

} bd
%</Chapter>

%<Chapter IncludeArmy>
/IncludeArmy {
	s
	/fk { k } bd
	%$ {.5 $MapDrawingScale mul}# w Black
	.15 w Black
	ShapeBarrel
	ShapeCarriage
	ShapeWheel

%<Part none/>

	r
} bd
%</Chapter>

%</Play>

%<Play Outlines /define bd/>

%<Play Shapes /define bd>

%<Chapter ShapeBarrel>
/ShapeBarrel {
	6 36 m
	66 36 l
	70 32 5.66 135 -45 a
	74 24 l
	14 24 l
	14 28 l
	2 1 x 3 24 4 45 90 a .5 1 x
	p
	fk

%<Part none/>

} bd
%</Chapter>

%<Chapter ShapeCarriage>
/ShapeCarriage {
	54 26 m
	94 6 l
	98 6 l 82 6 l
	42 26 l
	fk

%<Part none/>

} bd
%</Chapter>

%<Chapter ShapeWheel>
/ShapeWheel {
	64 22 m 46 22 18 0 360 a
	%$ 66 36 t -56.31 o {2.42}# {2.0 $MapDrawingScale mul}# m {0}# {2.0 $MapDrawingScale mul}# l {0}# {-2.0 $MapDrawingScale mul}# l {2.42}# {-2.0 $MapDrawingScale mul}# l {14.42}# {0 $MapDrawingScale mul}# l p 56.31 o -66 -36 t
	66 36 t -56.31 o 2.42 .6 m 0 .6 l 0 -.6 l 2.42 -.6 l 14.42 0 l p 56.31 o -66 -36 t
	%$ 98 6 t 137.49 o {20.560000000000002}# {2.0 $MapDrawingScale mul}# m {0}# {2.0 $MapDrawingScale mul}# l {0}# {-2.0 $MapDrawingScale mul}# l {20.560000000000002}# {-2.0 $MapDrawingScale mul}# l {32.56}# {0 $MapDrawingScale mul}# l p -137.49 o -98 -6 t
	98 6 t 137.49 o 20.56 .6 m 0 .6 l 0 -.6 l 20.56 -.6 l 32.56 0 l p -137.49 o -98 -6 t
	2 1 x 7 24 m 3 24 4 0 360 a .5 1 x
	fk

%<Part none/>

} bd
%</Chapter>

%</Play>

%<Play Installations>

%<Act DefineColors>
{
	currentdict end 3 1 roll [ exch /setgray load ] cvx def begin
}{
	currentdict end 5 1 roll [ 4 1 roll /setrgbcolor load ] cvx def begin
}{
	currentdict end 6 1 roll [ 5 1 roll /setcmykcolor load ] cvx def begin
} bind VisitColors
%</Act>

%<Sketch DefinePowers /$InitController {/ChangeController false def} /$Push {}>
%<+ /$AddController { dup /Controlled ChangeController put ChangeController {>
%<+ dup /Outer Power /Paint get put /ChangeController false def } if } /$Pull {>
%<+ } /$CreatePowerDict { 4 dict begin /Contrast xd /Paint xd /Offset xd>
%<+ /Letter xd currentdict end } /$GetLetterOffset { [ exch n 0 0 m true>
%<+ charpath pathbbox 3 2 roll add -2 div 3 1 roll add -2 div exch ] }>
s
MapUnitLetterFont z
{
	%$ $Push exch load exch load
	exch load exch load
	%$ 2 index $GetLetterOffset 3 1 roll $Pull
	2 index [ exch n 0 0 m true charpath pathbbox 3 2 roll add -2 div 3 1 roll add -2 div exch ] 3 1 roll
	%$ $CreatePowerDict
	4 dict begin /Contrast xd /Paint xd /Offset xd /Letter xd currentdict end
	%$ [ /Power 3 2 roll { $AddController } /exec load /def load ] cvx
	[ /Power 3 2 roll { dup /Controlled ChangeController put ChangeController { dup /Outer Power /Paint get put /ChangeController false def } if } /exec load /def load ] cvx
	currentdict end 3 1 roll def begin
} VisitPowers
r
%$ $InitController
/ChangeController false def
%</Sketch>

%<Scene Centers /operator ld /format {uname uname}>
/UNOWNEDCENTER /UNOWNED ld
%</Scene>

%</Play>

%</Play>
%%EndSetup

%%Page: Opening 1
%<Play Page>
DrawMap

%<Part none/>

ShowPage
%</Play>

%%Trailer
%%Pages: 1
